Developer Documentation

QuickTime 4 API Documentation

Inside Macintosh: Imaging with QuickDraw

Previous | Chapter Top | Chapter Contents | Next |

Changing the Background Pixel Pattern

Each graphics port has a background pattern that's used when an area is erased (such as by using the EraseRect procedure, described in the chapter "QuickDraw Drawing") and when pixels are scrolled out of an area (such as by using the ScrollRect procedure, described in the chapter "Basic QuickDraw"). The background pattern is stored in the bkPixPat field of every CGrafPort record. You can use the BackPixPat procedure to change the pixel pattern used as the background color by the current color graphics port.

BackPixPat

To assign a pixel pattern as the background pattern, you can use the BackPixPat procedure; this allows the ScrollRect procedure and the shape-erasing procedures (for example, EraseRect ) to fill the background with a colored, patterned "ink."

PROCEDURE BackPixPat (ppat: PixPatHandle);
ppat
A handle to the pixel pattern to use as the background pattern.

DESCRIPTION

The BackPixPat procedure sets the background pattern for the current graphics device to a pixel pattern. The BackPixPat procedure is similar to the basic QuickDraw procedure BackPat , except that you pass BackPixPat a handle to a multicolored pixel pattern instead of a bit pattern.

The BackPixPat procedure stores the handle to the pixel pattern in the bkPixPat field of the CGrafPort record. Because the handle to the pixel pattern is stored in the CGrafPort record, you should not dispose of this handle. QuickDraw removes all references to your pattern from an existing graphics port when you dispose of it.

If you use BackPixPat to set a background pixel pattern in a basic graphics port, the data in the pat1Data field of the PixPat record is placed into the bkPat field of the GrafPort record.

SPECIAL CONSIDERATIONS

The BackPixPat procedure may move or purge memory blocks in the application heap. Your application should not call this procedure at interrupt time.

SEE ALSO

The PixPat record is described on PixPat . To define your own pixel pattern, you can create a pixel pattern resource, which is described on The Pixel Pattern Resource , or you can use the NewPixPat function, which is described on NewPixPat .

The GrafPort record is described in the chapter "Basic QuickDraw." To set the background pattern to a bit pattern, you can also use the BackPat procedure, which is described in the chapter "QuickDraw Drawing" in this book. The BackPat procedure creates a handle, of type PixPatHandle , for the bit pattern and stores this handle in the bkPixPat field of the CGrafPort record. As in basic graphics ports, Color QuickDraw draws patterns in color graphics ports at the time of drawing, not at the time you use BackPat to set the pattern.


© 1997 Apple Computer, Inc.

Previous | Chapter Top | Chapter Contents | Next